package tr.edu.metu.is.mega.client.course.instructor.students;

import tr.edu.metu.is.mega.client.widgets.MegaCompositeField;
import tr.edu.metu.is.mega.common.dto.CourseDTO;

/**
 * Field for selecting course student.
 */
public class CourseStudentField extends MegaCompositeField {

    private final String boundAttribute;

    /**
     * Default constructor.
     * 
     * @param boundAttribute bound attribute
     * @param enablePersonEdit true to enable person edit
     * @param userRole user type to be displayed.
     */
    public CourseStudentField(String boundAttribute, CourseDTO course) {
        super(new CourseStudentWidget(course,true));
        this.boundAttribute = boundAttribute;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public String getBoundAttribute() {
        return boundAttribute;
    }

    @Override
    public void clear() {
        ((CourseStudentWidget) getWidget()).setValue(null);
    }

}
